use config::{Config, ConfigError, File};
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Image {
    pub rate: Option<f32>,
    pub width: Option<u32>,
    pub hight: Option<u32>,
}

#[derive(Debug, Deserialize)]
pub struct Settings {
    pub image: Image,
}

impl Settings {
    pub fn new() -> Result<Self, ConfigError> {
        let mut s = Config::new();
        s.merge(File::with_name("config"))?;
        s.try_into()
    }
}
